<?php 

function Internet_Secure_menu() {
  $items = array();
  $items['admin/settings/Internet_Secure'] = array(
    'title' => 'Internet Secure Settings',
    'description' => 'Settings for internet secure should be made here',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('Internet_Secure_settings_form'),
    'access arguments' => array('administer site configuration'),
    );
  return $items;
}

function Internet_Secure_settings_form() {
  drupal_add_css(drupal_get_path('module', 'Internet_Secure') .'/Internet_Secure.css');
  $_default_settings = array(
    'language' => 'English',
  	'SubscriptionHelp' => t('Please select a subscription plan. After your account is created you will be redirected to our secure payment site.'),
    );
  $Internet_Secure_settings = variable_get('Internet_Secure_settings', $_default_settings);

	$form['GatewayID'] = array(
	  '#type' => 'textfield', 
	  '#title' => t('Gateway ID'),
	  '#default_value' => $Internet_Secure_settings['GatewayID'],
	  '#size' => 25,
	  '#maxlength' => 20, 
	  '#description' => t('Enter the Gateway ID supplied by Internet Secure'),
	);
	$form['xxxTransType'] = array(
	  '#type' => 'textfield', 
	  '#title' => t('Trans Type'),
	  '#default_value' => $Internet_Secure_settings['xxxTransType'],
	  '#size' => 25,
	  '#maxlength' => 20, 
	  '#description' => t('Internet Secure transaction type'),
	);
	$form['language'] = array(
	  '#type' => 'textfield', 
	  '#title' => t('Language'),
	  '#default_value' => $Internet_Secure_settings['language'],
	  '#size' => 25,
	  '#maxlength' => 20, 
	  '#description' => t('Enter the language Internet Secure should use'),
	);
	$form['ReturnURL'] = array(
	  '#type' => 'textfield', 
	  '#title' => t('Return URL'),
	  '#default_value' => $Internet_Secure_settings['ReturnURL'],
	  '#size' => 120,
	  '#maxlength' => 100, 
	  /*'#description' => t('Enter the language Internet Secure should use'),*/
	);
	$form['xxxCancelURL'] = array(
	  '#type' => 'textfield', 
	  '#title' => t('Cancel URL'),
	  '#default_value' => $Internet_Secure_settings['xxxCancelURL'],
	  '#size' => 120,
	  '#maxlength' => 100, 
	  /*'#description' => t('Enter the language Internet Secure should use'),*/
	);
	$form['Products'] = array(
	  '#type' => 'textarea', 
	  '#title' => t('Products'),
	  '#default_value' => $Internet_Secure_settings['Products'],
      '#cols' => 60, 
      '#rows' => 5, 
	  '#description' => t('Please enter one product per line in the following format: [Product Code][semi colon][Cost][semi colon][Description] <br/> i.e. 001;3500;1 Year Standard Subscription'),
	);
	$form['SubscriptionHelp'] = array(
	  '#type' => 'textarea', 
	  '#title' => t('Subscription Help Text'),
	  '#default_value' => $Internet_Secure_settings['SubscriptionHelp'],
      '#cols' => 60, 
      '#rows' => 5, 
	  '#description' => t('This text will be displayed on the registration form above the select option'),
	);
	$form['Footer'] = array(
	  '#type' => 'textarea', 
	  '#title' => t('Footer Value'),
	  '#default_value' => $Internet_Secure_settings['Footer'],
      '#cols' => 60, 
      '#rows' => 5, 
	  '#description' => t('This text will be displayed on the registration form below the select option'),
	);
	$form['submit'] = array(
	  '#type' => 'submit',
	  '#value' => t('Save'),
	);
  return $form;
}

function Internet_Secure_settings_form_submit($form, &$form_state) {
	variable_set('Internet_Secure_settings', $form_state['values']);
  	drupal_set_message(t('Configuration has been updated. '), 'notice');
}